/*
 * @Description: 描述信息
 * @Version: 版本号
 * @Author: xuebao
 * @Date: 2023-12-08 14:26:41
 * @LastEditors: renmengxue
 * @LastEditTime: 2023-12-08 14:30:58
 */
import { defineStore } from 'pinia'

export interface GlobalErrorProps {
  status:boolean,
  message?:string
}

export interface GlobalStatusProps{
  error:GlobalErrorProps,
  loading:boolean
}

export const useGlobalStore = defineStore('global', {
  state: () :GlobalStatusProps => {
    return {
      error: { status: false },
      loading: false
    }
  },
  actions: {
    setLoading(status:boolean) {
      this.loading = status
    },
    setError(e:GlobalErrorProps) {
      this.error = e
    }
  }
})
